#define  _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"
#include "BinaryTree.h"

void test()
{
	SListNode* s1 = NULL;

	SLPushFront(&s1, 1);
	SLPushFront(&s1, 2);
	SLPushFront(&s1, 3);

	SLPushBack(&s1, 2);
	SLPushBack(&s1, 3);
	SLPushBack(&s1, 4);

	SLPopFront(&s1);
	SLPopFront(&s1);
	SLPopFront(&s1);

	SLPopBack(&s1);
	SLPopBack(&s1);
	SLPopBack(&s1);

	SLPrint(s1);

	SLPushFront(&s1, 1);
	SLPushFront(&s1, 2);
	SLPushFront(&s1, 3);

	SLPushBack(&s1, 2);
	SLPushBack(&s1, 3);
	SLPushBack(&s1, 4);

	SLPrint(s1);

	SLDestroy(s1);
}

void testtree()
{
	TreeNode* A = (TreeNode*)malloc(sizeof(TreeNode));
	TreeNode* B = (TreeNode*)malloc(sizeof(TreeNode));
	TreeNode* C = (TreeNode*)malloc(sizeof(TreeNode));
	TreeNode* D = (TreeNode*)malloc(sizeof(TreeNode));
	TreeNode* E = (TreeNode*)malloc(sizeof(TreeNode));
	TreeNode* F = (TreeNode*)malloc(sizeof(TreeNode));

	assert(A);
	assert(B);
	assert(C);
	assert(D);
	assert(E);
	assert(F);

	A->date = 1;
	B->date = 2;
	C->date = 3;
	D->date = 4;
	E->date = 5;
	F->date = 6;

	A->left = NULL;
	A->right = NULL;

	B->left = NULL;
	B->right = NULL;

	C->left = NULL;
	C->right = NULL;

	D->left = NULL;
	D->right = NULL;

	E->left = NULL;
	E->right = NULL;

	F->left = NULL;
	F->right = NULL;



	A->left = B;
	A->right = C;

	B->left = D;
	B->right = E;

	C->left = F;

	PreOrder(A);
	printf("\n");

	InOrder(A);
	printf("\n");

	PostOrder(A);
	printf("\n");
}

int main()
{
	//test();
	testtree();

	return 0;
}
